import { createBrowserRouter, Navigate, Outlet } from "react-router-dom";
import App from "../App";
import IndexLayOut from "../views/Index/IndexLayOut";
import LoginLayOut from "../views/login/LoginLayOut";
import Upload from "../components/Upload";
import SplashScreen from "../views/splash-screen";
import PyEditor from "../views/PyEditor";
import HomeLayout from "../views/main/HomeLayout";
import Home from "../views/main/Home";
import UploadPage from "../views/main/upload-page";
import { InfoCard } from "../components/ui/cards";
import DownloadPage from "../views/Download";
import DataCenter from "../views/main/DataCenter";
import { ModelView } from "../views/ModelView";
export const router = createBrowserRouter([
  {
    path: "/",
    element: <App></App>,
    children: [
      {
        path: "index",
        element: <IndexLayOut></IndexLayOut>,
      },
      //重定向旧路由
      {
        path: "old_b",
        element: <Navigate to="/b" replace></Navigate>,
      },
      {
        path: "login",
        element: <LoginLayOut></LoginLayOut>,
      },
      {
        path: "main",
        element: <HomeLayout></HomeLayout>,
        children: [
          {
            path: "home",
            element: <Home></Home>,
          },
          {
            path: "upload",
            element: <UploadPage></UploadPage>,
          },
          {
            path: "data",
            element: <DataCenter></DataCenter>,
          },
          {
            path: "model",
            element: <ModelView></ModelView>,
          },
        ],
      },
    ],
  },
  {
    path: "/upload",
    element: <Upload></Upload>,
  },
  {
    path: "/splashscreen",
    element: <SplashScreen></SplashScreen>,
  },
  {
    path: "/editor",
    element: <PyEditor></PyEditor>,
  },
  {
    path: "/preview",
    element: <InfoCard></InfoCard>,
  },
]);
